package com.manner.groupon.common;

import lombok.Data;

/**
 * @Author: Manner
 * @Description: 请求响应封装类
 * @DateTime: 2024/10/4 17:04
 */
@Data
public class BaseResponse<T> {

    private int code;

    private T data;

    private String message;

    public BaseResponse(int code, T data, String message) {
        this.code = code;
        this.data = data;
        this.message = message;
    }

    public BaseResponse(int code, T data) {
        this(code, data, "");
    }

    public BaseResponse(ErrorCode errorCode) {
        this(errorCode.getCode(), null, errorCode.getMessage());
    }

    public BaseResponse add(T data)
    {
        this.data = data;
        return this;
    }
}
